Exercises for Backward Chaining Algorithm
- Exercise 1: Let's define DNFs in arrays for rules and facts.
- Rule 0: If an animal croaks and eats flies, then the animal is frog.
- Rule 1: If an animal chirps and sings, then the animal is canary.
- Rule 2: If an animal is a frog, then the animal is green color.
- Rule 3: If an animal is a canary, then the animal is yellow color.
- Fact 0: An animal croaks.
- Fact 1: The animal eats flies.
- Query: yellow, or green?
- Propositional symbols: Croak, EatFly, Frog, Chirp, Sing, Canary, Green, Yellow
- Exercise 2: Let's check if a propositional symbol is a fact.
This exercise should be done after Exercise 1.
- Exercise 3: Let's check if there is a rule to use for a propositional symbol.
This exercise should be done after Exercise 2.
- Exercise 4: Let's write a recursive function for Backward Chaining.
This exercise should be done after Exercise 3.